package com.fairisanddog.controller;

import com.alibaba.fastjson.JSON;

import com.fairisanddog.entity.Users;
import com.fairisanddog.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.util.List;

public class Tesst {

    @Autowired
    @Qualifier("UsersServiceImpl")
    private UsersService usersService;

    public Users test() {

        List<Users> user = usersService.queryAllUsers();
        Users u1 = user.get(0);
        if (u1 != null) {
            return u1;
        } else {
            return null;
        }


    }

    public static void main(String[] args) {
        Tesst tesst = new Tesst();
        if (tesst.test() != null) {
            System.out.println("ok");
            String s = JSON.toJSONString(tesst.test());
            System.out.println(s);
        } else {
            System.out.println("no");
        }

    }

}
